<template>
  <div class="hospital-container">
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/' }"
        ><el-icon>
          <HomeFilled />
        </el-icon>
      </el-breadcrumb-item>
      <el-breadcrumb-item>医院详情</el-breadcrumb-item>
    </el-breadcrumb>
    <div class="hospital">
      <!-- 左侧导航区域 -->
      <div class="menu">
        <el-menu
          background-color="#fcfcfc"
          :default-active="route.path"
          class="el-menu-vertical-demo">
          <el-menu-item index="/hospital/register" @click="changeActice('/hospital/register')">
            <el-icon><icon-menu /></el-icon>
            <span>预约挂号</span>
          </el-menu-item>
          <el-menu-item index="/hospital/detail" @click="changeActice('/hospital/detail')">
            <el-icon><document /></el-icon>
            <span>医院详情</span>
          </el-menu-item>
          <el-menu-item index="/hospital/notice" @click="changeActice('/hospital/notice')">
            <el-icon><InfoFilled /></el-icon>
            <span>预约通知</span>
          </el-menu-item>
          <el-menu-item index="/hospital/close" @click="changeActice('/hospital/close')">
            <el-icon><setting /></el-icon>
            <span>停诊信息</span>
          </el-menu-item>
          <el-menu-item index="/hospital/search" @click="changeActice('/hospital/search')">
            <el-icon><Search /></el-icon>
            <span>查询/取消</span>
          </el-menu-item>
        </el-menu>
      </div>
      <!-- 右侧内容展示区域,路由组件展示位置 -->
      <div class="content">
        <RouterView />
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import {
  Document,
  Menu as IconMenu,
  HomeFilled,
  InfoFilled,
  Search,
  Setting
} from '@element-plus/icons-vue'
import { useRoute, useRouter } from 'vue-router'
import { ref, onMounted } from 'vue'
import useDetailStore from '@/store/modules/hospitalDetail'

const route = useRoute()
const router = useRouter()
const detailStore = useDetailStore()

// 获取参数
let hoscode = ref(route.query.hoscode + '')
const changeActice = (path: string) => {
  router.push(`${path}?hoscode=${hoscode.value}`)
}
onMounted(() => {
  detailStore.getHospitalData(hoscode.value)
  detailStore.getDepartment(hoscode.value)
})
</script>

<style lang="scss" scoped>
.el-breadcrumb {
  font-size: 16px;
  // border-bottom: 1px solid #efefef;
  padding: 15px 0 5px 0;
}
.menu {
  background-color: #fcfcfc;
  min-height: calc(100vh - 200px);
  border: 1px solid #efefef;
  border-radius: 4px;
  :deep(.el-menu-item) {
    height: 50px;
    line-height: 50px;
    // border-right: none !important;
  }
}
.hospital {
  display: flex;
  margin-top: 10px;
  .menu {
    flex: 2;
  }
  .content {
    flex: 10;
    padding: 0px 20px;
  }
}
</style>
